<%@ include file="/common/taglibs.jsp"%>
<%@ page pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<!-- jquery -->
		<script src="${jquery}/jquery.js"></script>
		<script src="${jquery}/jquery.form.js"></script>
		<!-- tabletree4j -->
		<script src="${tabletree4j}/Core4j.js"></script>
		<script src="${tabletree4j}/TableTree4j.js"></script>
		<link rel="stylesheet" type="text/css"
			href="${tabletree4j}/tabletree4j.css">
		<!-- colorbox -->
		<script type="text/javascript"
			src="${colorbox}/jquery.colorbox-min.js"></script>
		<link rel="stylesheet" type="text/css" href="${colorbox}/colorbox.css">
		<!-- easyui -->
		<script type="text/javascript" src="${easyui}/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="${easyui}/plugins/jquery.pagination.js"></script>
		<link rel="stylesheet" type="text/css"
			href="${easyui}/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css"
			href="${easyui}/themes/default/pagination.css">
		<!-- app -->
	    <link rel="stylesheet" type="text/css" href="${app}/hnjz.css">
	</HEAD>

	<body>
		
			<form id="funQuryForm" method="post" action="funQuery.json">
				<div id="search" class="divContainer">
					<input class="i-text" type="text" id="name" name="name"
						value="${name}" />
					<span class="btn btn-ok"> <input type="submit" value="搜索">
					</span>
					<a id="funAdd" href="editFun.htm" class="btslink">新建</a>
				</div>
				<div class="divContainer">
					<div id="worldcupgird"></div>
				</div>
			</form>
		
		<p>
	</body>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
//create and config tabletree object
function initTab(){
		return new Core4j.toolbox.TableTree4j({
		columns:[
				{isNodeClick:true,dataIndex:'title',width:'20%'},
				{dataIndex:'link',width:'20%',canSort:true},
				{dataIndex:'note',width:'35%'},
				{dataIndex:'order',width:'10%'},
				{width:'15%',canSort:false,renderFunction:operateRenderFunction}
				],
		headers:[{
			  	columns:[
				{dataIndex:'title'},
			    {dataIndex:'link'},
				{dataIndex:'note'},
				{dataIndex:'order'},
				{dataIndex:'operate'}
				],
				dataObject:{title:'功能名称',link:'链接',note:'备注',order:'排序',operate:'操作'},
				trAttributeNames:['classStyle','style'],
				trAttributeValueObject:{classStyle:'ejiaA1_bt',style:''}
			  }
			],
		treeMode:'gird',
		renderTo:'worldcupgird',
		useLine:true,
		useIcon:true,
		id:'myworldcupgirdtree',
		useCookie:true,
		themeName:'arrow',
		selectMode:'single'
	});
}
var fifaGirdTree = initTab();
//infoObj {dataValue:,node:,tabletreeObj:,rowObj:,rowIndex:,container:,columnIndex:}
function operateRenderFunction(infoObj){
	var re = "<a onclick=edit(this) id="+infoObj.node.id+" >编辑</a>  ";
	re += "<a onclick=del(this) id="+infoObj.node.id+" >删除</a>";
	return re;
}
function edit(curObj){
  	  $(curObj).colorbox({iframe:true, width:"90%", height:"90%",href:"editFun.htm?id="+curObj.id,title:"编辑功能菜单"});
}
function del(curObj){
	$.messager.confirm('菜单管理', '确定要删除当前菜单吗？', function(r){
		if (r){
			$.ajax({
			  url: "delFun.json?id="+curObj.id,
			  success:function(data){
				if(!data.state){
					$.messager.alert("菜单管理",data.msg);
				}
				$('#funQuryForm').submit();
			  }
			});
		}
	});

}

$('#funQuryForm').submit(function(){  
      $("#funQuryForm").ajaxSubmit({
     	  success: function(data){
     	      var treedata = eval('('+data.re+')');
	          fifaGirdTree.rebuildTreeByNodes(treedata,true);
	      }
	 });
     return false;  
});  
function ref(){
	jQuery().colorbox.close();
	$('#funQuryForm').submit();
}

$(document).ready(function(){
   // var aa=[{"id":"40288a933c8025bf013c802802900006","name":"通讯录管理","pid":"40288a893c6057ec013c605925ef0005","dataObject":{"title":"通讯录管理","order":0,"link":"txlMain.htm","note":"通讯录管理"}},{"id":"40288a893c6057ec013c605925ef0005","name":"任务管理","dataObject":{"title":"任务管理","order":0,"note":"任务管理"}},{"id":"40288a893df68983013df69253790005","name":"污染源","pid":"40288a893dedff4b013dee0179e80001","dataObject":{"title":"污染源","order":1,"note":"污染源"}},{"id":"40288a933c852499013c8528c2420001","name":"执法文件查询","pid":"40288a893c6057ec013c605925ef0005","dataObject":{"title":"执法文件查询","order":4,"link":"aaa","note":"执法文件查询"}},{"id":"40288a933c852499013c85295dc80005","name":"通讯录查询","pid":"40288a893c6057ec013c605925ef0005","dataObject":{"title":"通讯录查询","order":5,"link":"aaaaaaaaaa","note":"通讯录查询"}},{"id":"40288a933e2f3ad6013e2f44b7d00001","name":"手机功能管理","pid":"40288a893dedff4b013dee0179e80001","dataObject":{"title":"手机功能管理","order":11,"link":"aa","note":"手机功能管理"}},{"id":"40288aad3e3aac46013e3ae957450001","name":"手机权限管理","pid":"40288a893dedff4b013dee0179e80001","dataObject":{"title":"手机权限管理","order":12,"link":"aa","note":"手机权限管理"}},{"id":"40288a893d24c884013d24ca5acd0001","name":"检查单模板管理","pid":"40288a893c6057ec013c605925ef0005","dataObject":{"title":"检查单模板管理","order":15,"link":"aa","note":"检查单模板管理"}},{"id":"40288a933cf4f14a013cf4f619310005","name":"口污染物","pid":"40288a893c6057ec013c605925ef0005","dataObject":{"title":"废气排放口污染物","order":20,"link":"infectGasList.htm","note":"废气排放口污染物"}},{"id":"40288a893e157bb3013e157ebc9c0001","name":"各部门任务统计","pid":"40288a893dedff4b013dee0179e80001","dataObject":{"title":"各部门任务统计","order":21,"link":"work/statistics/dept_page.htm","note":"各部门任务统计"}},{"id":"40288ac43e1571f7013e16a99bba004b","name":"全省任务统计","pid":"40288a893dedff4b013dee0179e80001","dataObject":{"title":"全省","order":22,"link":"work/provincetask/qsrwtj_page.htm","note":"全省任务统计"}},{"id":"40288a893dedff4b013dee0179e80001","name":"信息统计","dataObject":{"title":"信息统计","order":26,"note":"信息统计"}},{"id":"40288a933d589cd8013d58a61c980005","name":"污染源原辅材料","pid":"40288aad3c612a3a013c613061ea0008","dataObject":{"title":"污染源原辅材料","order":75,"link":"stuffList.htm","note":"污染源原辅材料"}}];
   // fifaGirdTree.build(${re},true);
    
    $('#funQuryForm').submit();
    $("#funAdd").colorbox({iframe:true, width:"90%", height:"90%"});
});
</SCRIPT>